package com.itheima.sh.controller;

import com.itheima.sh.client.UserFeignApi;
import com.itheima.sh.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/*feign 的远程调用
* */

@RestController
@RequestMapping("feign")
public class FeignController {

    @Autowired
    UserFeignApi userFeignApi; //代理对象，实现子类存到IOC容器中

    @GetMapping("{id}")
    public User queryById(@PathVariable("id") String username){
        return userFeignApi.queryById(username);
    }
}
